class AdminFilters {

  def dependsOn = [UserFilters]

  def filters = {

    user(controller: "user", action: "list") {
      before = {
        if (!session.admin) {
          flash.message = "This is an admin area"
          redirect(controller: "index", action: "index")
          return false;
        }
      }
    }

    userGroupAssociation(controller: "userGroupAssociation", action: "*"){
      before = {
        if (!session.admin) {
          flash.message = "This is an admin area"
          redirect(controller: "index", action: "index")
          return false;
        }
      }
    }

    recording(controller: "recording") {
      before = {
        if (!session.admin) {
          flash.message = "This is an admin area"
          redirect(controller: "index", action: "index")
          return false;
        }
      }
    }

    recordingRequestAdmin(controller: "recordingRequestAdmin") {
      before = {
        if (!session.admin) {
          flash.message = "This is an admin area"
          redirect(controller: "index", action: "index")
          return false;
        }
      }
    }

    tvShow(controller: "tvShow", action: "(edit|delete|update)") {
      before = {
        if (!session.admin) {
          flash.message = "This is an admin area"
          redirect(controller: "index", action: "index")
          return false;
        }
      }
    }
  }
}
